<?php

/**
 * ListCountries form.
 *
 * @package    form
 * @subpackage list_countries
 * @version    SVN: $Id: sfPropelFormTemplate.php 6174 2007-11-27 06:22:40Z fabien $
 */
class ListCountriesForm extends BaseListCountriesForm
{
  public function configure()
  {
    $this->widgetSchema->setLabels(
      array(
        'name'=>'Country:',
        'currency_name'=>'Currency Name:',
        'currency_code'=>'Currency Code:',
      )
    );
    
    if($this->isNew())
      $this->validatorSchema['iden'] = new sfValidatorString(array('required' => true));
    $this->widgetSchema['name']->setAttributes(array('size'=>30,));
    $this->widgetSchema['currency_name']->setAttributes(array('size'=>20,));
    $this->widgetSchema['currency_code']->setAttributes(array('size'=>5,));
    
    $this->validatorSchema['name']->setOption('min_length',5);
    $this->validatorSchema['currency_name']->setOption('min_length',4);
    $this->validatorSchema['currency_code']->setOption('min_length',1);
    
  }
  
  public function getUrl(){
    if($this->isNew())
      return 'country/insert';
    else
      return 'country/update';
  }
  
  public function getDeleteUrl(){
      return 'country/delete?iden='.$this->getObject()->getIden();
  }
  
}
